import { Router } from 'express'
import { 
  getNotes, 
  getNoteById, 
  createNote, 
  updateNote, 
  deleteNote, 
  searchNotes,
  getTags 
} from '../controllers/noteController'
import { authMiddleware } from '../middleware/auth'

const router = Router()

// 所有笔记路由都需要认证
router.use(authMiddleware)

// 笔记CRUD操作
router.get('/', getNotes)
router.get('/search', searchNotes)
router.get('/tags', getTags)
router.get('/:id', getNoteById)
router.post('/', createNote)
router.put('/:id', updateNote)
router.delete('/:id', deleteNote)

export default router